﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common
{
    public interface IRedisHelper
    {
        /// <summary>
        /// 设置缓存
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="expiry"></param>
        /// <returns></returns>
        bool SetValue(string key, string value, TimeSpan? expiry = null);

        /// <summary>
        /// 获取缓存
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        string GetValue(string key);
        /// <summary>
        /// 删除缓存
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        bool DeleteKey(string key);
        /// <summary>
        /// 计数器
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        long IncrementCounter(string key);

        /// <summary>
        /// 获取计数器的值
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        long GetCounterValue(string key);
    }
}
